home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / MD.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  92 lines

  1. /* $Id: md.h,v 1.2 1997/12/27 16:28:38 jj Exp $
  2.  * md.h: High speed xor_block operation for RAID4/5 
  3.  *            utilizing the UltraSparc Visual Instruction Set.
  4.  *
  5.  * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  6.  */
  7.  
  8. #ifndef __ASM_MD_H
  9. #define __ASM_MD_H
  10.  
  11. #include <asm/head.h>
  12. #include <asm/asi.h>
  13.  
  14. #define HAVE_ARCH_XORBLOCK
  15.  
  16. #define MD_XORBLOCK_ALIGNMENT    64
  17.  
  18. /*    void __xor_block (char *dest, char *src, long len)
  19.  *    {
  20.  *        while (len--) *dest++ ^= *src++;
  21.  *     }
  22.  *
  23.  *    Requirements:
  24.  *    !(((long)dest | (long)src) & (MD_XORBLOCK_ALIGNMENT - 1)) &&
  25.  *    !(len & 127) && len >= 256
  26.  */
  27.  
  28. static inline void __xor_block (char *dest, char *src, long len)
  29. {
  30.     __asm__ __volatile__ ("
  31.     wr    %%g0, %3, %%fprs
  32.     wr    %%g0, %4, %%asi
  33.     membar    #LoadStore|#StoreLoad|#StoreStore
  34.     sub    %2, 128, %2
  35.     ldda    [%0] %4, %%f0
  36.     ldda    [%1] %4, %%f16
  37. 1:    ldda    [%0 + 64] %%asi, %%f32
  38.     fxor    %%f0, %%f16, %%f16
  39.     fxor    %%f2, %%f18, %%f18
  40.     fxor    %%f4, %%f20, %%f20
  41.     fxor    %%f6, %%f22, %%f22
  42.     fxor    %%f8, %%f24, %%f24
  43.     fxor    %%f10, %%f26, %%f26
  44.     fxor    %%f12, %%f28, %%f28
  45.     fxor    %%f14, %%f30, %%f30
  46.     stda    %%f16, [%0] %4
  47.     ldda    [%1 + 64] %%asi, %%f48
  48.     ldda    [%0 + 128] %%asi, %%f0
  49.     fxor    %%f32, %%f48, %%f48
  50.     fxor    %%f34, %%f50, %%f50
  51.     add    %0, 128, %0
  52.     fxor    %%f36, %%f52, %%f52
  53.     add    %1, 128, %1
  54.     fxor    %%f38, %%f54, %%f54
  55.     subcc    %2, 128, %2
  56.     fxor    %%f40, %%f56, %%f56
  57.     fxor    %%f42, %%f58, %%f58
  58.     fxor    %%f44, %%f60, %%f60
  59.     fxor    %%f46, %%f62, %%f62
  60.     stda    %%f48, [%0 - 64] %%asi
  61.     bne,pt    %%xcc, 1b
  62.      ldda    [%1] %4, %%f16
  63.     ldda    [%0 + 64] %%asi, %%f32
  64.     fxor    %%f0, %%f16, %%f16
  65.     fxor    %%f2, %%f18, %%f18
  66.     fxor    %%f4, %%f20, %%f20
  67.     fxor    %%f6, %%f22, %%f22
  68.     fxor    %%f8, %%f24, %%f24
  69.     fxor    %%f10, %%f26, %%f26
  70.     fxor    %%f12, %%f28, %%f28
  71.     fxor    %%f14, %%f30, %%f30
  72.     stda    %%f16, [%0] %4
  73.     ldda    [%1 + 64] %%asi, %%f48
  74.     membar    #Sync
  75.     fxor    %%f32, %%f48, %%f48
  76.     fxor    %%f34, %%f50, %%f50
  77.     fxor    %%f36, %%f52, %%f52
  78.     fxor    %%f38, %%f54, %%f54
  79.     fxor    %%f40, %%f56, %%f56
  80.     fxor    %%f42, %%f58, %%f58
  81.     fxor    %%f44, %%f60, %%f60
  82.     fxor    %%f46, %%f62, %%f62
  83.     stda    %%f48, [%0 + 64] %%asi
  84.     membar    #Sync|#StoreStore|#StoreLoad
  85.     wr    %%g0, 0, %%fprs
  86.     " : :
  87.     "r" (dest), "r" (src), "r" (len), "i" (FPRS_FEF), "i" (ASI_BLK_P) :
  88.     "cc", "memory");
  89. }
  90.  
  91. #endif /* __ASM_MD_H */
  92.